package vn.codespot.hms.model.request;

import java.util.Map;

import vn.codespot.hms.utils.JSonUtils;

public abstract class AbsRequestModel implements IRequestModel {
    protected abstract Map<String, String> getData();

    protected String getUrgentlyAsString(boolean urgently) {
        return urgently == true ? "1" : "0";
    }

    protected boolean getSpecialAsBoolean(String special) {
        if ("1".equals(special)) {
            return true;
        } else if ("0".equals(special)) {
            return false;
        } else {
            return false;
        }
    }

    @Override
    public String convertToJson() {
        return JSonUtils.getJSonAsString(getDataAsMap());
    }

    @Override
    public Map<String, String> getDataAsMap() {
        return getData();
    }
}
